<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="user" class="entity.User" scope="session"/>
<jsp:useBean id="currentPlayer" class="entity.Players" scope="request"/>
<jsp:useBean id="players" class="java.util.ArrayList" scope="request"/>
<html>
	<head>
		<title>Recreation Manager - Glasanje za MVP</title>
		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="theme.css">
		<script type="text/javascript" src="scripts/linkfader.js"></script>
	</head>
	<c:if test="${user.userId==null}">
		<c:redirect url="./login.jsp" />
	</c:if>
	<body>
	<center>
	
	<c:import url="./header.jsp"></c:import>
	<table class="mainTable">
		<tr>
			<td width="200px" valign="top">
				<c:import url="./menu.jsp"></c:import>
			</td>			
			<td valign="top">
			<!-- itt kezdodik -->
				<table class="list">
				<thead>
					<tr>
						<th colspan = "5"><h2>Glasanje za MVP igrača</h2></th>
					</tr>
					<tr>
						<th colspan="2">Igrač</th>
						<th>Golova dao</th>
						<th>Trenutni broj glasova:</th>
						<th>&nbsp;</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${players}" var="player">
						<tr>
							<td><img src = "./avatar/${player.user.avatar}"/></td>
							<td>${player.user.firstName} ${player.user.lastName}</td>
							<td>${player.goal}</td>
							<td>${player.mvp}</td>
							<td>
							<c:if test="${currentPlayer.playersId!=null}">
								<c:if test="${currentPlayer.vote!=true}">
									<c:if test="${user.userId!=player.user.userId}">
										<form name="votePlayerForm" action="./VoteForMvp" method="post">
											<input type="hidden" name="playerId" value="${player.playersId}">
											<input type="hidden" name="votingPlayerId" value ="${currentPlayer.playersId}">
											<input type="submit" name="submit" value="Glasaj">
										</form>
									</c:if>
								</c:if>
							</c:if>
							</td>
						</tr>
					</c:forEach>
				</tbody>
				</table>
			<!-- itt vegzodik -->
			</td>
		</tr>
	</table>
	
	</center>
	</body>	
</html>